package com.guodefu.unifiedresponse;

/**
 * 接口状态公共枚举类
 * 请谨慎在此类添加枚举值
 * 接口特殊枚举，请创建单独的枚举类，实现BusinessExceptionAssert接口
 * @author guodefu909
 * @since 2020-08-23 01:24:00
 */
public enum ResultEnum implements ExceptionAssert {


    //		★★★4开头：入参问题；
    NOT_SUPPORTED_METHOD("401","该接口不支持当前请求方式"),
    MAX_UPLOAD_SIZE_EXCEEDED("402", "上传文件过大"),
    DUPLICATE_REQUEST("403","请勿重复请求"),
    TIMESTAMP_OUT_OF_SCOPE("410","时间戳超出范围"),
    TIMESTAMP_ERROR("411","时间戳异常"),
    SIGN_ERROR("412","签名异常"),
    CHANNEL_ERROR("413","渠道异常"),
    CHANNEL_NOT_DELEGATED("414","渠道未授权"),

    PAG_CURRENT_ERROR("451","分页参数current异常"),
    PAG_SIZE_ERROR("452","分页参数size异常"),

    //		★★★5开头：内部问题；
//		JSON转换异常
    UNSUPPORTED_ENCODING_ERROR("512","不支持的加密方式"),
    JSON_PARSE_ERROR("513","JSON解析异常"),
    JSON_PROCESSING_ERROR("514","JSON转换异常"),
    SCRIPT_EVAL_ERROR("515","脚本解析异常"),

    URL_ENCODE_ERROR("509","URL编码异常"),
    URL_DECODE_ERROR("510","URL解码异常"),

    //		★★★6开头：业务问题；
    PIC_CHECK_FAILURE("508","图形验证码校验失败"),
    SMS_CODE_EXPIRED("505", "短信验证码过期"),
    SMS_SEND_FAILURE("504", "短信验证码发送失败"),
    SMS_CHECK_FAILURE("507","短信验证码校验失败"),
//		验证码等辅助功能

    //		注册登录业务异常
    TOKEN_NULL("522", "尚未登录，请登录"),
    TOKEN_EXPIRED("523", "登录过期，请重新登录"),
    TOKEN_CHECK_FAILURE("521", "登录状态校验失败"),
    TOKEN_LAST_LOGIN_ERROR("524", "最后登录记录异常"),
    TOKEN_ISSUED_DATE_ERROR("522", "token发布时间异常"),
    TOKEN_REFRESH_INTERVAL_ERROR("532", "token刷新间隔异常"),

    LOGIN_ACCOUNT_PWD_ERROR("526", "账号或密码不正确"),
    REGISTER_ERROR("528","注册失败"),

    THIRD_PARTY_LOGIN_NOT_SUPPORT("531", "不支持的第三方账号登录方式"),
    UPLOAD_AVATAR_ERROR("532", "上传头像异常"),

    //		开关
    SMS_CHECK_NULL("561", "短信校验开关异常"),
    SINGLE_MACHINE_NULL("562", "单设备登录开关异常"),
    MOCK_QQ_LOGIN_NULL("563", "模拟QQ登录开关异常"),
    MOCK_WX_LOGIN_NULL("564", "模拟微信登录开关异常"),
    MOCK_WB_LOGIN_NULL("565", "模拟新浪微博登录开关异常"),

    //		关联系统
    QQ_USER_INFO_ERROR("591", "QQ用户信息解析异常"),
    QQ_OPENID_ERROR("592", "QQ openid 解析异常"),
    QQ_ACCESS_TOKEN_ERROR("593", "QQ accessToken 解析异常"),

    //		★★★7开头：权限问题；
    SERVICE_DENY_ACCESS("751", "没有当前service访问权限"),



    BAD_REQUEST("441","错误的请求"),
    NO_SUCH_ELEMENT("442","找不到元素"),
    PARAMETER_ERROR("443","参数异常"),
    RESULT_ERROR("444","结果异常"),
    HTTP_MESSAGE_NOT_READABLE("446","HTTP消息不可读"),
    METHOD_NOT_ALLOWED("447","HTTP请求方法不支持"),
    MISSING_REQUEST_PARAMETER("448","缺失必传参数"),
    CONSTRAINT_VIOLATION_PARAMETER("449","违反约束参数"),

    /**
     * 200, "成功"
     */
    SUCCESS("200", "成功"),
    /**
     * 500, "很抱歉，服务器出了点状况"
     */
    SYSTEM_ERROR("500", "很抱歉，服务器出了点状况"),
    ;

    private final String code;

    private final String message;

    ResultEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }
    @Override
    public String getCode() {
        return code;
    }
    @Override
    public String getMessage() {
        return message;
    }

}